Skip to content

Add eveonline integration#166674

Closed
ronaldvdmeer wants to merge 49 commits intohome-assistant:devfrom
ronaldvdmeer:add-eveonline-integration
Closed

Add eveonline integration#166674
ronaldvdmeer wants to merge 49 commits intohome-assistant:devfrom
ronaldvdmeer:add-eveonline-integration

Conversation

@ronaldvdmeer
Copy link
Copy Markdown
Contributor

@ronaldvdmeer ronaldvdmeer commented Mar 27, 2026

Proposed change

Add a new integration for Eve Online, a massively multiplayer online game by CCP Games. This integration connects to the Eve Swagger Interface (ESI) API via OAuth2 (Eve SSO) to provide character data as sensors in Home Assistant.

The code has been written with the platinum quality scale in mind (including strict typing, exception translations, icon translations, entity categories, and full test coverage), but the quality scale is set to bronze as required for new integrations.

Entities

Character sensors (14):

  • Location, Ship, Wallet balance, Total SP, Unallocated SP
  • Skill queue count, Current training skill, Current skill finish
  • Unread mail, Industry jobs, Next industry finish
  • Sell orders, Buy orders, Jump fatigue

The integration uses the python-eveonline library (v0.4.0) and implements OAuth2 via Application Credentials. It supports multiple characters and reconfiguration.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

Copy link
Copy Markdown

@home-assistant home-assistant bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new eveonline Home Assistant integration that authenticates via Eve SSO (OAuth2 / application_credentials) and exposes Tranquility server status plus per-character telemetry as sensors and binary sensors.

Changes:

  • Introduces the new homeassistant.components.eveonline integration (OAuth2 config flow, coordinator, entities, sensors/binary_sensors, diagnostics, translations/icons, manifest/quality scale).
  • Adds comprehensive test coverage for config flow, setup/unload, entities, and diagnostics (including snapshots).
  • Registers the integration across generated registries, strict typing/mypy settings, code ownership, and requirements lists.

Reviewed changes

Copilot reviewed 27 out of 30 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
homeassistant/components/eveonline/init.py Sets up platforms and OAuth2 session/client wiring; forwards entry setups.
homeassistant/components/eveonline/api.py Implements EveOnline auth adapter backed by HA OAuth2Session.
homeassistant/components/eveonline/application_credentials.py Declares the Eve SSO authorization/token endpoints for application_credentials.
homeassistant/components/eveonline/binary_sensor.py Adds server + character binary sensors backed by the coordinator.
homeassistant/components/eveonline/config_flow.py Implements OAuth2 config flow, unique-id handling, reauth/reconfigure.
homeassistant/components/eveonline/const.py Defines domain, OAuth endpoints, and required ESI scopes.
homeassistant/components/eveonline/coordinator.py Polls ESI endpoints and aggregates server + character data.
homeassistant/components/eveonline/diagnostics.py Provides diagnostics payload and redaction.
homeassistant/components/eveonline/entity.py Defines base entities and device registry metadata.
homeassistant/components/eveonline/icons.json Adds icon mappings for entities.
homeassistant/components/eveonline/manifest.json Declares integration metadata, deps, requirements, and iot_class.
homeassistant/components/eveonline/quality_scale.yaml Documents quality scale rule status for the new integration.
homeassistant/components/eveonline/sensor.py Adds server + character sensors backed by the coordinator.
homeassistant/components/eveonline/strings.json Adds translations for config flow, entity names, and exceptions.
homeassistant/generated/application_credentials.py Registers eveonline as providing application credentials.
homeassistant/generated/config_flows.py Registers eveonline as having a config flow.
homeassistant/generated/integrations.json Adds eveonline integration metadata to generated registry.
tests/components/eveonline/init.py Initializes the test package for the integration.
tests/components/eveonline/conftest.py Provides fixtures for credentials, config entry, and mocked client responses.
tests/components/eveonline/test_binary_sensor.py Validates binary sensor creation, state, and default-disabled behavior.
tests/components/eveonline/test_config_flow.py Validates user flow, duplicate handling, reauth, and reconfigure.
tests/components/eveonline/test_diagnostics.py Validates diagnostics output via snapshot testing.
tests/components/eveonline/test_init.py Validates setup success and error paths, plus unload behavior.
tests/components/eveonline/test_sensor.py Validates sensor values and unavailable states.
tests/components/eveonline/snapshots/test_diagnostics.ambr Snapshot for diagnostics payload.
CODEOWNERS Adds ownership for integration and its tests.
.strict-typing Enforces strict typing for homeassistant.components.eveonline.*.
mypy.ini Adds mypy strictness configuration for the integration package.
requirements_all.txt Adds python-eveonline==0.2.1 to core requirements list.
requirements_test_all.txt Adds python-eveonline==0.2.1 to test requirements list.

Copilot AI review requested due to automatic review settings March 27, 2026 08:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 27 out of 30 changed files in this pull request and generated 5 comments.

Copilot AI review requested due to automatic review settings March 27, 2026 09:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 27 out of 30 changed files in this pull request and generated 4 comments.

Copilot AI review requested due to automatic review settings March 27, 2026 09:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 27 out of 30 changed files in this pull request and generated 3 comments.

Copilot AI review requested due to automatic review settings March 27, 2026 09:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 28 out of 31 changed files in this pull request and generated 3 comments.

Copilot AI review requested due to automatic review settings March 27, 2026 10:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 28 out of 31 changed files in this pull request and generated 3 comments.

@ronaldvdmeer
Copy link
Copy Markdown
Contributor Author

ronaldvdmeer commented Mar 27, 2026

Hi!

Greetings from the Netherlands

This is my first custom integration for Home Assistant, and I'm honestly pretty excited to share it. I've been playing Eve Online for years and using Home Assistant just as long, so combining the two felt like a fun project to work on.

I've tried to stick closely to the contribution guidelines, pushed for full test coverage (38 tests), and addressed the review comments along the way. Hopefully that shows in the code.

Here's how the integration looks in practice:

Integration overview: shared Tranquility server device (3 entities) + per-character device (15 entities):
Monosnap Integrations – Home Assistant 2026-03-27 15-53-59

Character device detail: all sensors and activity log:
Monosnap Devices – Home Assistant 2026-03-27 15-53-00

The icon shows "not available" because the brands PR (home-assistant/brands#10036) hasn't been merged yet. Character name redacted for privacy.

Curious to hear what you think, and of course happy to iterate further. Thanks for taking a look!

@ronaldvdmeer ronaldvdmeer marked this pull request as ready for review March 27, 2026 11:17
Copilot AI review requested due to automatic review settings March 27, 2026 11:17
…s, snapshot tests, parametrize tests

- Fix manifest.json: set integration_type to 'service' (not 'hub')
- quality_scale.yaml: add missing Silver rule config-entry-unloading; fix reauthentication-flow to todo (no async_step_reauth in config_flow)
- conftest.py: use CONF_CHARACTER_ID/CONF_CHARACTER_NAME constants; add init_integration fixture
- test_sensor.py: use snapshot_platform for entity state testing; enable disabled entities before snapshot; add parametrized value test and unavailable sensor test
- test_init.py: use init_integration fixture; merge 3 duplicate optional endpoint error tests into one parametrized test; add missing imports
- conftest.py: use .return_value = instead of AsyncMock(return_value=...) — autospec already creates AsyncMock for coroutine methods
- sensor.py: remove redundant round() in wallet_balance value_fn; suggested_display_precision handles display rounding
- quality_scale.yaml: add comment to todo rules (reauthentication-flow, diagnostics, reconfiguration-flow)
…rarchy

- api.py: raise UpdateFailed (not ConfigEntryNotReady) for transient
  OAuth token errors so the coordinator can handle them gracefully
  during periodic updates
- sensor.py: remove intermediate EveOnlineSensor base class; move
  native_value and entity_description directly into EveOnlineCharacterSensor
- conftest.py: fix Generator return type annotation to full form
  Generator[AsyncMock, None, None] for strict mypy compliance
- test_api.py: update assertions to expect UpdateFailed instead of
  ConfigEntryNotReady for transient errors
@ronaldvdmeer ronaldvdmeer force-pushed the add-eveonline-integration branch from 2b295d9 to 920f868 Compare April 13, 2026 14:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 24 out of 27 changed files in this pull request and generated no new comments.

@ronaldvdmeer
Copy link
Copy Markdown
Contributor Author

ronaldvdmeer commented Apr 13, 2026

Note

The sudden appearance of 45 commits in the timeline is an artifact of a forced rebase. The branch had a conflict in homeassistant/generated/config_flows.py caused by new integrations merged into dev since this PR was opened. Resolving it required git rebase upstream/dev + force-push, which rewrites all commit SHAs. GitHub then shows all existing commits as newly added. The actual diff against dev is unchanged — only eveonline integration files and the standard generated files.

@ronaldvdmeer ronaldvdmeer marked this pull request as draft April 13, 2026 14:53
…ffline

Replace the single EveOnlineCoordinator with four coordinators, each
polling at the ESI server-side cache interval for its endpoints:

- EveOnlineCoordinator (60 s): online, location, ship, wallet, mail
- EveOnlineIndustryCoordinator (300 s): industry jobs, jump fatigue,
  skill queue
- EveOnlineMarketCoordinator (3600 s): market orders
- EveOnlineSkillsCoordinator (86400 s): skills / total SP

This reduces ESI calls from 660/hour to ~410/hour when online.

Additionally, location and ship are skipped entirely when the character
is offline. Those values don't change while logged out, so the calls
would only return stale cached data. This further reduces calls to
~230/hour when offline.

All four coordinators do their first refresh in parallel via
asyncio.gather so startup time is unchanged.
- Use asyncio.gather for parallel ESI calls in fast and industry
  coordinators (wallet+mail in parallel; location+ship in parallel
  when online; industry_jobs+jump_fatigue+skill_queue in parallel)
- Remove ImplementationUnavailableError try/except from async_setup_entry
  and its unused strings.json translation key
- Remove third-party configuration_url (evewho.com) from DeviceInfo
- Fix entity-event-setup quality scale rule: should be exempt (uses
  DataUpdateCoordinator, no direct event subscription)
Copilot AI review requested due to automatic review settings April 13, 2026 16:29
@ronaldvdmeer
Copy link
Copy Markdown
Contributor Author

ronaldvdmeer commented Apr 13, 2026

I’ve been doing some refactoring to reduce the load and address the concerns raised by @joostlek. I hope this is a good compromise. See link to discussion

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 24 out of 27 changed files in this pull request and generated 7 comments.

…lity

- Fix docstrings: remove stale 'skill queue' references from
  EveOnlineCoordinator and EveOnlineCharacterSensor
- Preserve last known location/ship when character is offline instead
  of resetting to None (sensors keep their previous state)
- Remove trailing period from authentication_failed exception message
  per HA convention
- Rename test_unavailable_sensor -> test_sensor_without_data_shows_unknown
  to match the asserted behavior (unknown, not unavailable)
- Replace brittle OAuth URL string equality with URL parsing in config
  flow test so scope ordering and encoding do not cause false failures
@ronaldvdmeer ronaldvdmeer marked this pull request as ready for review April 13, 2026 16:48
Copilot AI review requested due to automatic review settings April 13, 2026 16:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 24 out of 27 changed files in this pull request and generated 2 comments.

- reconfiguration-flow: exempt — OAuth2-only, no user-configurable params
- Fix Python 2 except syntax: except (ValueError, KeyError, jwt.DecodeError)
- Remove stale ESI cache interval comment from FAST_SCAN_INTERVAL
@ronaldvdmeer ronaldvdmeer marked this pull request as draft April 13, 2026 21:10
@ronaldvdmeer
Copy link
Copy Markdown
Contributor Author

Closing this PR. Will submit new PR with limited scope. Will adjust documentation PR

@github-actions github-actions bot locked and limited conversation to collaborators Apr 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants